/**
 * @fileoverview settime 第二个参数禁止是数字
 * @author testRule
 */
'use strict';
module.exports = {
  meta: {
    type: 'suggestion',
    docs: {
      description: 'settime 第二个参数禁止是数字',
      category: 'Fill me in',
      recommended: false
    },
    fixable: null, // or "code" or "whitespace"
    messages: {},
    schema: [
      // fill in your schema
    ]
  },
  create: function (context) {
    return {
      CallExpression: function (node) {
        if (node.callee.name !== 'setTimeout') return;
        const timerNode = node.arguments && node.arguments[1];
        if (!timerNode) return;
        if (
          timerNode.type === 'Literal' &&
          typeof timerNode.value === 'number'
        ) {
          context.report({
            node,
            message: '{{valName}}第二个参数禁止是数字',
            data: {
              valName: node.callee.name
            }
          });
        }
      }
    };
  }
};
